package com.jiankang.controller;

import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.jiankang.entity.DailyReport;
import com.jiankang.entity.User;
import com.jiankang.service.DailyReportService;
import com.jiankang.service.UserService;
import com.jiankang.util.Page;
//每日
@Controller
@RequestMapping("/DailyReport")
public class DailyReportController {
	@Resource
	private DailyReportService dailyReportService;
	@Resource
	private UserService  userService ;
	//每日问题情况列表
	@RequestMapping("/listdailyreport")
	public String listdailyreport(Model model, HttpServletRequest req)throws Exception 
	{
		List<User> user=userService.getAllUser();
		String pageNow = req.getParameter("pageNow");
		Page page = null;
		List<DailyReport> dailyreport=null;
		int totalCount = (int) dailyReportService.getAllProductCount();
		if (pageNow != null) {
			page = new Page(totalCount, Integer.parseInt(pageNow));
			dailyreport=dailyReportService.getHealthFile(page);
		}else{
			page = new Page(totalCount, 1);
			dailyreport=dailyReportService.getHealthFile(page);
		}
		model.addAttribute("page", page);
		model.addAttribute("dailyreport", dailyreport);
		model.addAttribute("user", user);
		return "admin/listdailyreport";
	}
}	
